package com.cne.gmail.Gmail.controller;

import com.cne.gmail.Gmail.Util.CacheUtil;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.ConcurrentMap;

@RestController
@RequestMapping("test")
public class TestController {
    @RequestMapping("ip")
    public String getip() throws UnknownHostException {


        InetAddress inetAddress=InetAddress.getLocalHost();
        return inetAddress.getHostAddress();

    }
    @RequestMapping("put")
    public Object put(@RequestParam String emailAddress,@RequestParam String historyId){
        Object o = CacheUtil.CacheEmail(emailAddress, historyId);
        return o;
    }
    @RequestMapping("remove")
    public Object remove(@RequestParam String emailAddress){
        Object o = CacheUtil.removeEmailAdress(emailAddress);
        return o;
    }
    @RequestMapping("getCache")
    public Object getCache(){
        ConcurrentMap<Object, Object> cache = CacheUtil.getCache();
        return cache;
    }






}
